package com.tg.app.helper;

import android.content.Context;

import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;

import java.util.List;

public class NotifyPermissionHelper {

    public static void openNotifyPermission(Context context, NotifyPermissionListener notifyPermissionListener) {
        XXPermissions.with(context).permission(Permission.NOTIFICATION_SERVICE).request(new OnPermissionCallback() {
            @Override
            public void onGranted(List<String> permissions, boolean all) {
                if (notifyPermissionListener != null){
                    notifyPermissionListener.onNotifictaionGranted();
                }

            }

            @Override
            public void onDenied(List<String> permissions, boolean never) {
                if (notifyPermissionListener != null){
                    notifyPermissionListener.onNotifictaionDenied();
                }

            }
        });
    }

    public interface NotifyPermissionListener {
        void onNotifictaionGranted();
        void onNotifictaionDenied();
    }
}
